package com.example.housingRentalSystem.mapper;

import com.example.housingRentalSystem.bean.House;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;


@Mapper
public interface HouseMapper {

    Page<House> selectHouse(
            @Param("city") String city,
            @Param("rentType") String rentType,
            @Param("minRent") Integer minRent,
            @Param("maxRent") Integer maxRent,
            @Param("sortBy") String sortBy,
            @Param("order") String order,
            @Param("status") Integer status,
            @Param("ownerId")Integer ownerId,
            @Param("id") Integer id,
            @Param("title") String title
            );

    House selectHouseById(@Param("id") Integer id);

    int insertHouse(House house);

    int updateHouse(House house);
    int updateHouseStatus(@Param("id") Integer id, @Param("status") Integer status);

    int selectHouseCount();

    List<Map<String, Object>> findNewHousesCountByDayThisWeek();

    List<House> selectHouseByOwnerId(@Param("ownerId") Integer ownerId);
    List<House> selectHouseByStatus(@Param("status") Integer status);
}